﻿@using umbraco.MacroEngines
  
@{
      string propertyName = Parameter.PropertyAlias;
      string showInAllPages = Parameter.ShowInAllPages;
      string fromParentNode = Parameter.FromParentNode;
      string strId = Parameter.ContentId;
      dynamic Index = Model;
      if (showInAllPages == "1")
      {
         Index = Model.AncestorOrSelf();
      }
      else if (fromParentNode == "1")
      {
         Index = Model.Parent;
      }
      else if (!string.IsNullOrEmpty(strId))
      {
          int tempInt;
          int id = int.TryParse(strId, out tempInt) ? tempInt : 0;
          Index = new DynamicNode(id);    
      }
      
      if (Index.HasProperty(propertyName))
      {
        @Html.Raw(Index.GetProperty(propertyName).Value)
      }
}